const express = require('express');
const { getAIData } = require("../module/baiduAI");
const router = express.Router();

// 获取动态
router.get('/trendsList', async (req, res) => {
  const data = {}
  res.json(data)
})

// 发布动态
router.post('/addTrendsForAI', async (req, res) => {
  console.log('req')
  console.log(req.body.text)
  const data = await getAIData(req.body.text)
  console.log('data')
  console.log(data)
  if (data.code === 500) {
    res.json(data)
  } else {
    const arr = data.result.split('\n')
    console.log(arr)
    res.json({
      code: 200,
      msg: '请求成功',
      data: data
    })
  }
})

// 发布动态
router.post('/addTrends', (req, res) => {

})

// 删除动态
router.delete('/delTrends', (req, res) => {

})

// 更新动态
router.post('/editTrends', (req, res) => {

})

// 收藏动态
router.post('/collectTrends', (req, res) => {

})

// 点赞动态
router.post('/likeTrends', (req, res) => {

})

//

module.exports = router;
